package com.cgbl.cg.adapter

import android.os.Bundle
import com.cgbl.cg.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.configs.AppConstants
import com.robot.base.model.CollectDetailBean
import com.robot.base.util.arouter.ARouterUtil
import com.robot.base.utils.pic.ImageLoaderUtils

class SelectCollectionAdapter :
    BaseQuickAdapter<CollectDetailBean, BaseViewHolder>(R.layout.app_item_select_collection) {
    override fun convert(holder: BaseViewHolder, item: CollectDetailBean) {

        holder.setText(R.id.item_tv_content, item.collectName)
            .setText(R.id.item_tv_name, item.accountNickName)
            .setText(R.id.item_tv_collect, item.worksCount?:"0")
        ImageLoaderUtils.displayCirclePortrait(context, holder.getView(R.id.item_iv_avatar), item.accountHead)
        ImageLoaderUtils.displayRound(context, holder.getView(R.id.item_iv_img), item.collectImages, 8)

        holder.itemView.setOnClickListener {
            ARouterUtil.goToActivityWithBundle(AppConstants.Router.COLLECTION.A_COLLECTIONS_DETAILS,
                Bundle().apply {
                    putString(
                        AppConstants.BundleKey.COLLECTION_DATA,
                        item.collectId
                    )
                }
            )
        }
    }
}